import torch

from refiners.conversion.utils import Conversion, Hub, WeightRecipe

diffusers_recipe = WeightRecipe(
    key_map={
        "vision_model.embeddings.patch_embedding": "ViTEmbeddings.Concatenate.Chain.PatchEncoder.Conv2d",
        "vision_model.embeddings.position_embedding": "ViTEmbeddings.Residual.PositionalEncoder.Embedding",
        "vision_model.embeddings.class_embedding": "ViTEmbeddings.Concatenate.ClassToken.Parameter.weight",
        "vision_model.pre_layrnorm": "LayerNorm_1",
        "vision_model.encoder.layers.0.layer_norm1": "Chain.TransformerLayer_1.Residual_1.LayerNorm",
        "vision_model.encoder.layers.0.layer_norm2": "Chain.TransformerLayer_1.Residual_2.LayerNorm",
        "vision_model.encoder.layers.1.layer_norm1": "Chain.TransformerLayer_2.Residual_1.LayerNorm",
        "vision_model.encoder.layers.1.layer_norm2": "Chain.TransformerLayer_2.Residual_2.LayerNorm",
        "vision_model.encoder.layers.2.layer_norm1": "Chain.TransformerLayer_3.Residual_1.LayerNorm",
        "vision_model.encoder.layers.2.layer_norm2": "Chain.TransformerLayer_3.Residual_2.LayerNorm",
        "vision_model.encoder.layers.3.layer_norm1": "Chain.TransformerLayer_4.Residual_1.LayerNorm",
        "vision_model.encoder.layers.3.layer_norm2": "Chain.TransformerLayer_4.Residual_2.LayerNorm",
        "vision_model.encoder.layers.4.layer_norm1": "Chain.TransformerLayer_5.Residual_1.LayerNorm",
        "vision_model.encoder.layers.4.layer_norm2": "Chain.TransformerLayer_5.Residual_2.LayerNorm",
        "vision_model.encoder.layers.5.layer_norm1": "Chain.TransformerLayer_6.Residual_1.LayerNorm",
        "vision_model.encoder.layers.5.layer_norm2": "Chain.TransformerLayer_6.Residual_2.LayerNorm",
        "vision_model.encoder.layers.6.layer_norm1": "Chain.TransformerLayer_7.Residual_1.LayerNorm",
        "vision_model.encoder.layers.6.layer_norm2": "Chain.TransformerLayer_7.Residual_2.LayerNorm",
        "vision_model.encoder.layers.7.layer_norm1": "Chain.TransformerLayer_8.Residual_1.LayerNorm",
        "vision_model.encoder.layers.7.layer_norm2": "Chain.TransformerLayer_8.Residual_2.LayerNorm",
        "vision_model.encoder.layers.8.layer_norm1": "Chain.TransformerLayer_9.Residual_1.LayerNorm",
        "vision_model.encoder.layers.8.layer_norm2": "Chain.TransformerLayer_9.Residual_2.LayerNorm",
        "vision_model.encoder.layers.9.layer_norm1": "Chain.TransformerLayer_10.Residual_1.LayerNorm",
        "vision_model.encoder.layers.9.layer_norm2": "Chain.TransformerLayer_10.Residual_2.LayerNorm",
        "vision_model.encoder.layers.10.layer_norm1": "Chain.TransformerLayer_11.Residual_1.LayerNorm",
        "vision_model.encoder.layers.10.layer_norm2": "Chain.TransformerLayer_11.Residual_2.LayerNorm",
        "vision_model.encoder.layers.11.layer_norm1": "Chain.TransformerLayer_12.Residual_1.LayerNorm",
        "vision_model.encoder.layers.11.layer_norm2": "Chain.TransformerLayer_12.Residual_2.LayerNorm",
        "vision_model.encoder.layers.12.layer_norm1": "Chain.TransformerLayer_13.Residual_1.LayerNorm",
        "vision_model.encoder.layers.12.layer_norm2": "Chain.TransformerLayer_13.Residual_2.LayerNorm",
        "vision_model.encoder.layers.13.layer_norm1": "Chain.TransformerLayer_14.Residual_1.LayerNorm",
        "vision_model.encoder.layers.13.layer_norm2": "Chain.TransformerLayer_14.Residual_2.LayerNorm",
        "vision_model.encoder.layers.14.layer_norm1": "Chain.TransformerLayer_15.Residual_1.LayerNorm",
        "vision_model.encoder.layers.14.layer_norm2": "Chain.TransformerLayer_15.Residual_2.LayerNorm",
        "vision_model.encoder.layers.15.layer_norm1": "Chain.TransformerLayer_16.Residual_1.LayerNorm",
        "vision_model.encoder.layers.15.layer_norm2": "Chain.TransformerLayer_16.Residual_2.LayerNorm",
        "vision_model.encoder.layers.16.layer_norm1": "Chain.TransformerLayer_17.Residual_1.LayerNorm",
        "vision_model.encoder.layers.16.layer_norm2": "Chain.TransformerLayer_17.Residual_2.LayerNorm",
        "vision_model.encoder.layers.17.layer_norm1": "Chain.TransformerLayer_18.Residual_1.LayerNorm",
        "vision_model.encoder.layers.17.layer_norm2": "Chain.TransformerLayer_18.Residual_2.LayerNorm",
        "vision_model.encoder.layers.18.layer_norm1": "Chain.TransformerLayer_19.Residual_1.LayerNorm",
        "vision_model.encoder.layers.18.layer_norm2": "Chain.TransformerLayer_19.Residual_2.LayerNorm",
        "vision_model.encoder.layers.19.layer_norm1": "Chain.TransformerLayer_20.Residual_1.LayerNorm",
        "vision_model.encoder.layers.19.layer_norm2": "Chain.TransformerLayer_20.Residual_2.LayerNorm",
        "vision_model.encoder.layers.20.layer_norm1": "Chain.TransformerLayer_21.Residual_1.LayerNorm",
        "vision_model.encoder.layers.20.layer_norm2": "Chain.TransformerLayer_21.Residual_2.LayerNorm",
        "vision_model.encoder.layers.21.layer_norm1": "Chain.TransformerLayer_22.Residual_1.LayerNorm",
        "vision_model.encoder.layers.21.layer_norm2": "Chain.TransformerLayer_22.Residual_2.LayerNorm",
        "vision_model.encoder.layers.22.layer_norm1": "Chain.TransformerLayer_23.Residual_1.LayerNorm",
        "vision_model.encoder.layers.22.layer_norm2": "Chain.TransformerLayer_23.Residual_2.LayerNorm",
        "vision_model.encoder.layers.23.layer_norm1": "Chain.TransformerLayer_24.Residual_1.LayerNorm",
        "vision_model.encoder.layers.23.layer_norm2": "Chain.TransformerLayer_24.Residual_2.LayerNorm",
        "vision_model.encoder.layers.24.layer_norm1": "Chain.TransformerLayer_25.Residual_1.LayerNorm",
        "vision_model.encoder.layers.24.layer_norm2": "Chain.TransformerLayer_25.Residual_2.LayerNorm",
        "vision_model.encoder.layers.25.layer_norm1": "Chain.TransformerLayer_26.Residual_1.LayerNorm",
        "vision_model.encoder.layers.25.layer_norm2": "Chain.TransformerLayer_26.Residual_2.LayerNorm",
        "vision_model.encoder.layers.26.layer_norm1": "Chain.TransformerLayer_27.Residual_1.LayerNorm",
        "vision_model.encoder.layers.26.layer_norm2": "Chain.TransformerLayer_27.Residual_2.LayerNorm",
        "vision_model.encoder.layers.27.layer_norm1": "Chain.TransformerLayer_28.Residual_1.LayerNorm",
        "vision_model.encoder.layers.27.layer_norm2": "Chain.TransformerLayer_28.Residual_2.LayerNorm",
        "vision_model.encoder.layers.28.layer_norm1": "Chain.TransformerLayer_29.Residual_1.LayerNorm",
        "vision_model.encoder.layers.28.layer_norm2": "Chain.TransformerLayer_29.Residual_2.LayerNorm",
        "vision_model.encoder.layers.29.layer_norm1": "Chain.TransformerLayer_30.Residual_1.LayerNorm",
        "vision_model.encoder.layers.29.layer_norm2": "Chain.TransformerLayer_30.Residual_2.LayerNorm",
        "vision_model.encoder.layers.30.layer_norm1": "Chain.TransformerLayer_31.Residual_1.LayerNorm",
        "vision_model.encoder.layers.30.layer_norm2": "Chain.TransformerLayer_31.Residual_2.LayerNorm",
        "vision_model.encoder.layers.31.layer_norm1": "Chain.TransformerLayer_32.Residual_1.LayerNorm",
        "vision_model.encoder.layers.31.layer_norm2": "Chain.TransformerLayer_32.Residual_2.LayerNorm",
        "vision_model.post_layernorm": "LayerNorm_2",
        "vision_model.encoder.layers.0.self_attn.q_proj": "Chain.TransformerLayer_1.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.0.self_attn.k_proj": "Chain.TransformerLayer_1.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.0.self_attn.v_proj": "Chain.TransformerLayer_1.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.0.self_attn.out_proj": "Chain.TransformerLayer_1.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.1.self_attn.q_proj": "Chain.TransformerLayer_2.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.1.self_attn.k_proj": "Chain.TransformerLayer_2.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.1.self_attn.v_proj": "Chain.TransformerLayer_2.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.1.self_attn.out_proj": "Chain.TransformerLayer_2.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.2.self_attn.q_proj": "Chain.TransformerLayer_3.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.2.self_attn.k_proj": "Chain.TransformerLayer_3.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.2.self_attn.v_proj": "Chain.TransformerLayer_3.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.2.self_attn.out_proj": "Chain.TransformerLayer_3.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.3.self_attn.q_proj": "Chain.TransformerLayer_4.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.3.self_attn.k_proj": "Chain.TransformerLayer_4.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.3.self_attn.v_proj": "Chain.TransformerLayer_4.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.3.self_attn.out_proj": "Chain.TransformerLayer_4.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.4.self_attn.q_proj": "Chain.TransformerLayer_5.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.4.self_attn.k_proj": "Chain.TransformerLayer_5.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.4.self_attn.v_proj": "Chain.TransformerLayer_5.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.4.self_attn.out_proj": "Chain.TransformerLayer_5.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.5.self_attn.q_proj": "Chain.TransformerLayer_6.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.5.self_attn.k_proj": "Chain.TransformerLayer_6.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.5.self_attn.v_proj": "Chain.TransformerLayer_6.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.5.self_attn.out_proj": "Chain.TransformerLayer_6.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.6.self_attn.q_proj": "Chain.TransformerLayer_7.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.6.self_attn.k_proj": "Chain.TransformerLayer_7.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.6.self_attn.v_proj": "Chain.TransformerLayer_7.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.6.self_attn.out_proj": "Chain.TransformerLayer_7.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.7.self_attn.q_proj": "Chain.TransformerLayer_8.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.7.self_attn.k_proj": "Chain.TransformerLayer_8.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.7.self_attn.v_proj": "Chain.TransformerLayer_8.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.7.self_attn.out_proj": "Chain.TransformerLayer_8.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.8.self_attn.q_proj": "Chain.TransformerLayer_9.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.8.self_attn.k_proj": "Chain.TransformerLayer_9.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.8.self_attn.v_proj": "Chain.TransformerLayer_9.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.8.self_attn.out_proj": "Chain.TransformerLayer_9.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.9.self_attn.q_proj": "Chain.TransformerLayer_10.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.9.self_attn.k_proj": "Chain.TransformerLayer_10.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.9.self_attn.v_proj": "Chain.TransformerLayer_10.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.9.self_attn.out_proj": "Chain.TransformerLayer_10.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.10.self_attn.q_proj": "Chain.TransformerLayer_11.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.10.self_attn.k_proj": "Chain.TransformerLayer_11.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.10.self_attn.v_proj": "Chain.TransformerLayer_11.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.10.self_attn.out_proj": "Chain.TransformerLayer_11.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.11.self_attn.q_proj": "Chain.TransformerLayer_12.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.11.self_attn.k_proj": "Chain.TransformerLayer_12.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.11.self_attn.v_proj": "Chain.TransformerLayer_12.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.11.self_attn.out_proj": "Chain.TransformerLayer_12.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.12.self_attn.q_proj": "Chain.TransformerLayer_13.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.12.self_attn.k_proj": "Chain.TransformerLayer_13.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.12.self_attn.v_proj": "Chain.TransformerLayer_13.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.12.self_attn.out_proj": "Chain.TransformerLayer_13.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.13.self_attn.q_proj": "Chain.TransformerLayer_14.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.13.self_attn.k_proj": "Chain.TransformerLayer_14.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.13.self_attn.v_proj": "Chain.TransformerLayer_14.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.13.self_attn.out_proj": "Chain.TransformerLayer_14.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.14.self_attn.q_proj": "Chain.TransformerLayer_15.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.14.self_attn.k_proj": "Chain.TransformerLayer_15.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.14.self_attn.v_proj": "Chain.TransformerLayer_15.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.14.self_attn.out_proj": "Chain.TransformerLayer_15.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.15.self_attn.q_proj": "Chain.TransformerLayer_16.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.15.self_attn.k_proj": "Chain.TransformerLayer_16.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.15.self_attn.v_proj": "Chain.TransformerLayer_16.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.15.self_attn.out_proj": "Chain.TransformerLayer_16.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.16.self_attn.q_proj": "Chain.TransformerLayer_17.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.16.self_attn.k_proj": "Chain.TransformerLayer_17.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.16.self_attn.v_proj": "Chain.TransformerLayer_17.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.16.self_attn.out_proj": "Chain.TransformerLayer_17.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.17.self_attn.q_proj": "Chain.TransformerLayer_18.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.17.self_attn.k_proj": "Chain.TransformerLayer_18.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.17.self_attn.v_proj": "Chain.TransformerLayer_18.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.17.self_attn.out_proj": "Chain.TransformerLayer_18.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.18.self_attn.q_proj": "Chain.TransformerLayer_19.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.18.self_attn.k_proj": "Chain.TransformerLayer_19.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.18.self_attn.v_proj": "Chain.TransformerLayer_19.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.18.self_attn.out_proj": "Chain.TransformerLayer_19.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.19.self_attn.q_proj": "Chain.TransformerLayer_20.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.19.self_attn.k_proj": "Chain.TransformerLayer_20.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.19.self_attn.v_proj": "Chain.TransformerLayer_20.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.19.self_attn.out_proj": "Chain.TransformerLayer_20.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.20.self_attn.q_proj": "Chain.TransformerLayer_21.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.20.self_attn.k_proj": "Chain.TransformerLayer_21.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.20.self_attn.v_proj": "Chain.TransformerLayer_21.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.20.self_attn.out_proj": "Chain.TransformerLayer_21.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.21.self_attn.q_proj": "Chain.TransformerLayer_22.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.21.self_attn.k_proj": "Chain.TransformerLayer_22.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.21.self_attn.v_proj": "Chain.TransformerLayer_22.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.21.self_attn.out_proj": "Chain.TransformerLayer_22.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.22.self_attn.q_proj": "Chain.TransformerLayer_23.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.22.self_attn.k_proj": "Chain.TransformerLayer_23.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.22.self_attn.v_proj": "Chain.TransformerLayer_23.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.22.self_attn.out_proj": "Chain.TransformerLayer_23.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.23.self_attn.q_proj": "Chain.TransformerLayer_24.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.23.self_attn.k_proj": "Chain.TransformerLayer_24.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.23.self_attn.v_proj": "Chain.TransformerLayer_24.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.23.self_attn.out_proj": "Chain.TransformerLayer_24.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.24.self_attn.q_proj": "Chain.TransformerLayer_25.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.24.self_attn.k_proj": "Chain.TransformerLayer_25.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.24.self_attn.v_proj": "Chain.TransformerLayer_25.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.24.self_attn.out_proj": "Chain.TransformerLayer_25.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.25.self_attn.q_proj": "Chain.TransformerLayer_26.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.25.self_attn.k_proj": "Chain.TransformerLayer_26.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.25.self_attn.v_proj": "Chain.TransformerLayer_26.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.25.self_attn.out_proj": "Chain.TransformerLayer_26.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.26.self_attn.q_proj": "Chain.TransformerLayer_27.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.26.self_attn.k_proj": "Chain.TransformerLayer_27.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.26.self_attn.v_proj": "Chain.TransformerLayer_27.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.26.self_attn.out_proj": "Chain.TransformerLayer_27.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.27.self_attn.q_proj": "Chain.TransformerLayer_28.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.27.self_attn.k_proj": "Chain.TransformerLayer_28.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.27.self_attn.v_proj": "Chain.TransformerLayer_28.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.27.self_attn.out_proj": "Chain.TransformerLayer_28.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.28.self_attn.q_proj": "Chain.TransformerLayer_29.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.28.self_attn.k_proj": "Chain.TransformerLayer_29.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.28.self_attn.v_proj": "Chain.TransformerLayer_29.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.28.self_attn.out_proj": "Chain.TransformerLayer_29.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.29.self_attn.q_proj": "Chain.TransformerLayer_30.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.29.self_attn.k_proj": "Chain.TransformerLayer_30.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.29.self_attn.v_proj": "Chain.TransformerLayer_30.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.29.self_attn.out_proj": "Chain.TransformerLayer_30.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.30.self_attn.q_proj": "Chain.TransformerLayer_31.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.30.self_attn.k_proj": "Chain.TransformerLayer_31.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.30.self_attn.v_proj": "Chain.TransformerLayer_31.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.30.self_attn.out_proj": "Chain.TransformerLayer_31.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.31.self_attn.q_proj": "Chain.TransformerLayer_32.Residual_1.SelfAttention.Distribute.Linear_1",
        "vision_model.encoder.layers.31.self_attn.k_proj": "Chain.TransformerLayer_32.Residual_1.SelfAttention.Distribute.Linear_2",
        "vision_model.encoder.layers.31.self_attn.v_proj": "Chain.TransformerLayer_32.Residual_1.SelfAttention.Distribute.Linear_3",
        "vision_model.encoder.layers.31.self_attn.out_proj": "Chain.TransformerLayer_32.Residual_1.SelfAttention.Linear",
        "vision_model.encoder.layers.0.mlp.fc1": "Chain.TransformerLayer_1.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.1.mlp.fc1": "Chain.TransformerLayer_2.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.2.mlp.fc1": "Chain.TransformerLayer_3.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.3.mlp.fc1": "Chain.TransformerLayer_4.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.4.mlp.fc1": "Chain.TransformerLayer_5.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.5.mlp.fc1": "Chain.TransformerLayer_6.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.6.mlp.fc1": "Chain.TransformerLayer_7.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.7.mlp.fc1": "Chain.TransformerLayer_8.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.8.mlp.fc1": "Chain.TransformerLayer_9.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.9.mlp.fc1": "Chain.TransformerLayer_10.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.10.mlp.fc1": "Chain.TransformerLayer_11.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.11.mlp.fc1": "Chain.TransformerLayer_12.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.12.mlp.fc1": "Chain.TransformerLayer_13.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.13.mlp.fc1": "Chain.TransformerLayer_14.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.14.mlp.fc1": "Chain.TransformerLayer_15.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.15.mlp.fc1": "Chain.TransformerLayer_16.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.16.mlp.fc1": "Chain.TransformerLayer_17.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.17.mlp.fc1": "Chain.TransformerLayer_18.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.18.mlp.fc1": "Chain.TransformerLayer_19.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.19.mlp.fc1": "Chain.TransformerLayer_20.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.20.mlp.fc1": "Chain.TransformerLayer_21.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.21.mlp.fc1": "Chain.TransformerLayer_22.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.22.mlp.fc1": "Chain.TransformerLayer_23.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.23.mlp.fc1": "Chain.TransformerLayer_24.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.24.mlp.fc1": "Chain.TransformerLayer_25.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.25.mlp.fc1": "Chain.TransformerLayer_26.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.26.mlp.fc1": "Chain.TransformerLayer_27.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.27.mlp.fc1": "Chain.TransformerLayer_28.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.28.mlp.fc1": "Chain.TransformerLayer_29.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.29.mlp.fc1": "Chain.TransformerLayer_30.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.30.mlp.fc1": "Chain.TransformerLayer_31.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.31.mlp.fc1": "Chain.TransformerLayer_32.Residual_2.FeedForward.Linear_1",
        "vision_model.encoder.layers.0.mlp.fc2": "Chain.TransformerLayer_1.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.1.mlp.fc2": "Chain.TransformerLayer_2.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.2.mlp.fc2": "Chain.TransformerLayer_3.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.3.mlp.fc2": "Chain.TransformerLayer_4.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.4.mlp.fc2": "Chain.TransformerLayer_5.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.5.mlp.fc2": "Chain.TransformerLayer_6.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.6.mlp.fc2": "Chain.TransformerLayer_7.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.7.mlp.fc2": "Chain.TransformerLayer_8.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.8.mlp.fc2": "Chain.TransformerLayer_9.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.9.mlp.fc2": "Chain.TransformerLayer_10.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.10.mlp.fc2": "Chain.TransformerLayer_11.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.11.mlp.fc2": "Chain.TransformerLayer_12.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.12.mlp.fc2": "Chain.TransformerLayer_13.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.13.mlp.fc2": "Chain.TransformerLayer_14.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.14.mlp.fc2": "Chain.TransformerLayer_15.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.15.mlp.fc2": "Chain.TransformerLayer_16.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.16.mlp.fc2": "Chain.TransformerLayer_17.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.17.mlp.fc2": "Chain.TransformerLayer_18.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.18.mlp.fc2": "Chain.TransformerLayer_19.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.19.mlp.fc2": "Chain.TransformerLayer_20.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.20.mlp.fc2": "Chain.TransformerLayer_21.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.21.mlp.fc2": "Chain.TransformerLayer_22.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.22.mlp.fc2": "Chain.TransformerLayer_23.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.23.mlp.fc2": "Chain.TransformerLayer_24.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.24.mlp.fc2": "Chain.TransformerLayer_25.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.25.mlp.fc2": "Chain.TransformerLayer_26.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.26.mlp.fc2": "Chain.TransformerLayer_27.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.27.mlp.fc2": "Chain.TransformerLayer_28.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.28.mlp.fc2": "Chain.TransformerLayer_29.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.29.mlp.fc2": "Chain.TransformerLayer_30.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.30.mlp.fc2": "Chain.TransformerLayer_31.Residual_2.FeedForward.Linear_2",
        "vision_model.encoder.layers.31.mlp.fc2": "Chain.TransformerLayer_32.Residual_2.FeedForward.Linear_2",
        "visual_projection": "Linear",
    },
    tensor_reshapes={
        "ViTEmbeddings.Concatenate.ClassToken.Parameter.weight": (1, 1280),
    },
)


unclip_21 = Conversion(
    original=Hub(
        repo_id="stabilityai/stable-diffusion-2-1-unclip",
        filename="image_encoder/model.safetensors",
        revision="e99f66a92bdcd1b0fb0d4b6a9b81b3b37d8bea44",
        expected_sha256="9d277aeaed13ebc0ef33e56027b826a74433d45d755b3e0b3829440c1ea7b72e",
    ),
    converted=Hub(
        repo_id="refiners/sd21.unclip.image_encoder",
        filename="model.safetensors",
        expected_sha256="c9f43e359e06f1a237324c4c11734d6acd7fbddbfd3b1ed4f1b525267bedb812",
    ),
    recipe=diffusers_recipe,
    dtype=torch.float16,
)
